﻿#region Imports
using System;
using System.Windows.Data;
#endregion

namespace LinqDemo.Converters
{
    public class NAConverter : IValueConverter
    {
        #region Declarations
        const int iDefault = -9999;
        #endregion

        #region Methods
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (Utilities.Utilities.IsNumeric(value))
                if (System.Convert.ToInt32(value) != iDefault)
                    return value;
                else
                    return "N/A";
            else
                return "N/A";
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
        #endregion
    }
}
